$(function () {
    //获取需要的元素
    var $course_boxs=$('.course_boxs');
    $move=$(".course_boxs>.container")
    var $uls=$('.course_boxs>.container>.course_list');
    var $arrows=$('.course_boxs>.arrows');
    var $arrlt=$('.arr_lt');
    var $arrrt=$('.arr_rt');
    var count=0;
    //上一张
    $arrlt.click(function () {
        count--;
        if(count==-1){
            count=$uls.length-2;//点击后看到的图
            $move.css({left:-($uls.length-1)*$course_boxs.width()});
        }
        $move.animate({left:-count*$course_boxs.width()});
    });
    //下一张
    $arrrt.click(function () {
        count++;
        if(count==$uls.length){
            count=1;
            $move.css({left:0})
        }
        $move.animate({left:-count*$course_boxs.width()});
    });
    //鼠标移入移出
    $course_boxs.mouseenter(function () {
        $arrows.stop().fadeIn(400);
    }).mouseleave(function () {
        $arrows.stop().fadeOut(400);
    });
});